#include "DMRS.hpp"
#include <complex>

using namespace std;
// double r = 0.707106781186;
#define r 0.707106781186

void PBCH_DMRS(complex<double> *pbch_dmrs)
{
	int x[300] = {1, 0, 0, 0, 0, 0, 0, 0, 0};
	for (int i = 9; i < 300; i++)
	{
		x[i] = (x[i - 5] + x[i - 9]) % 2;
	}
	for (int i = 0; i < 144; i++)
	{
		pbch_dmrs[i].real(r * (1 - 2 * x[2 * i]));
		pbch_dmrs[i].imag(r * (1 - 2 * x[2 * i + 1]));
	}
}
void PDSCH_DMRS(complex<double> *pdsch_dmrs)
{
	int x[300] = {1, 0, 0, 0, 0, 0, 0, 0, 0};
	for (int i = 9; i < 300; i++)
	{
		x[i] = (x[i - 5] + x[i - 9]) % 2;
	}
	for (int i = 0; i < 150; i++)
	{
		pdsch_dmrs[i].real(r * (1 - 2 * x[2 * i]));
		pdsch_dmrs[i].imag(r * (1 - 2 * x[2 * i + 1]));
	}
}